package codegen;

import java.util.ArrayList;
import java.util.List;

import ins.framework.mybatis.generator.GenConfig;
import ins.framework.mybatis.generator.GenParam;
import ins.framework.mybatis.generator.GenType;
import ins.framework.mybatis.generator.Generator;

public class CodeGenerator {

	public static void main(String[] args) {
		List<GenParam> paramList = new ArrayList<GenParam>();
		paramList.add(new GenParam("sysuser", new String[] { "sys_user", "sys_user_property", "sys_user_run_as" }));
		paramList.add(new GenParam("sys", new String[] { "sys_application", "sys_area_dict", "sys_cas_login",
				"sys_code_dict", "sys_trans_config" }));
		paramList.add(new GenParam("sdd", new String[] { "sdd_code", "sdd_type" }));
		paramList.add(new GenParam("menu", new String[] { "smc_menu" }));
		paramList.add(new GenParam("sysuser", new String[] { "sys_user" }));
		paramList.add(new GenParam("saa", new String[] { "saa_factor", "saa_factor_field", "saa_role", "saa_role_task",
				"saa_task", "saa_user_power", "saa_user_role" }));
		paramList.add(new GenParam("robot",new String[]{"demo_robot_main","demo_robot_job"})); 
		paramList.add(new GenParam("bpo",new String[]{"bpo_customer","bpo_file","bpo_file_cfg","bpo_file_folder","bpo_file_image","bpo_task","bpo_user_customer","image_source"})); 
		GenConfig gc = new GenConfig();
		gc.setBasePackage("ins.platform");
		// mysql 数据库相关配置
		// 设置基本保存目录（Java源代码根目录）
		// gc.setSaveDir("D:/Work/lab_cloud/server/misc/misc-server/src/main/java");
		gc.setSaveDir("src/main/java");
		//VO为独立项目时可使用setSaveDirForVo来设置不同的目录
		//gc.setSaveDirForVo(new File(gc.getSaveDir(), "../../../../misc-vo/src/main/java").getAbsolutePath());
		gc.setDbDriverName("com.mysql.jdbc.Driver");
		gc.setDbUser("platform");
		gc.setDbSchema("platform_devdb");
		gc.setDbPassword("2765d074b741596325f1979c7b8d2b5b");
		gc.setDbUrl("jdbc:mysql://poc.jsptz.com:3306/platform_devdb?useUnicode=true&characterEncoding=utf-8");
		// 生成PO\VO（自动覆盖）、BaseMapperXML（覆盖）、Dao（不覆盖）、MapperXML（不覆盖）
		// 支持生成的文件类型
		gc.setGenTypes(
				new GenType[] { GenType.VO, GenType.PO, GenType.DAO, GenType.BASE_MAPPER_XML, GenType.MAPPER_XML });
		Generator generator = new Generator();
		generator.setGenConfig(gc);
		generator.setParamList(paramList);
		generator.generate();
	}
}
